//
//  MYGHomeMoreSectionView.swift
//  MYGrow
//
//  Created by 小火科技 on 2024/3/6.
//

import UIKit

class MYGToolsCollectionReusableView: UICollectionReusableView {
    // MARK: - init
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        configUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    // MARK: - UI
    private func configUI() {
        addSubview(lineView)
        addSubview(nameLabel)
        
        lineView.snp.makeConstraints { make in
            make.centerY.equalTo(nameLabel)
            make.left.equalToSuperview().inset(17)
            make.width.equalTo(3)
            make.height.equalTo(15)
        }
        
        nameLabel.snp.makeConstraints { make in
            make.left.equalTo(lineView.snp.right).offset(10)
            make.bottom.equalToSuperview()
        }
    }
    // MARK: - lazy load
    private lazy var lineView: UIView = {
        let view = UIView()
        let gl = CAGradientLayer()
        gl.colors = [UIColor.rgba(202, 172, 255, 1).cgColor, UIColor.rgba(143, 134, 255, 1).cgColor]
        gl.locations = [0, 1]
        gl.frame = CGRect(x: 0, y: 0, width: 3, height: 15)
        gl.startPoint = CGPoint(x: 0, y: 0)
        gl.endPoint = CGPoint(x: 1, y: 1)
        
        gl.masksToBounds = true
        gl.cornerRadius = 1.5
        view.layer.addSublayer(gl)
        return view
    }()
    
    private(set) lazy var nameLabel: UILabel = {
        let label = UILabel()
        label.font = .medium(18)
        label.textColor = .rgba(34, 34, 34, 1)
        
        return label
    }()
}
